package roman.algorithm;
import java.util.List;

import roman.algorithm.Graph.Edge;


public class Kruskal {
	static void kruskal(int length, UnionFind uf, List<Edge> mst, BinaryHeap<Edge> edges){
		int counter = 0;
		int a, b;
		while(counter < length -1){
			Edge tmp = edges.remove();
			a = uf.find(tmp.fromNode);
			b = uf.find(tmp.toNode);
			if(a != b){
				uf.union(a, b);
				mst.add(tmp);
				counter++;
			}
		}
	}
}
